package com.conlin.learn.io;

import com.conlin.learn.common.contant.Contant;
import com.conlin.learn.common.proxy.CommonService;

import java.io.*;

public class NormalStreamCopyDecorator implements CommonService {
    @Override
    public void doSomething() {
        String path = "K:\\jdk-8u171-windows-x64.exe";
        String outPath = "J:\\java_work\\files\\jdk-8u171-windows-x64_nb.exe";

        try (FileInputStream bufferedInputStream = new FileInputStream(path);
             FileOutputStream bufferedOutputStream = new FileOutputStream(outPath)) {

            // 使用 transferTo() 方法进行大块数据传输
            bufferedInputStream.transferTo(bufferedOutputStream);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
